//
//  F2DTexture.h
//  Framework2D
//
//  Created by Jorge Lorenzon on 5/29/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

//martin

#import <Foundation/Foundation.h>
#import <OpenGLES/ES1/gl.h>

// Enumerators for the different pixel formats this class can handle
typedef enum {
	kTexture2DPixelFormat_Automatic = 0,
	kTexture2DPixelFormat_RGBA8888,
	kTexture2DPixelFormat_RGB565,
	kTexture2DPixelFormat_A8,
} Texture2DPixelFormat;

@interface F2DTexture : NSObject
{
    int glId;
    
@private
	
	GLuint name;			// Holds the OpenGL name generated for this texture
	CGSize contentSize;		// Stores the actual size of the image being loaded as a texture
	NSUInteger width;		// The actual width and height of the texture once it has been adjusted to be
	NSUInteger height;		// power of 2 compliant
	GLfloat	maxS;			// Maximum texture coordinates for the image that has been placed inside our texture.
	GLfloat	maxT;
    CGSize textureRatio;	// The ratio between pixels and texels (texture coordinates)
    Texture2DPixelFormat pixelFormat;	// The pixel format of the image that has been loaded
}

@property(nonatomic, readonly) GLuint name;
@property(nonatomic, readonly) CGSize contentSize;
@property(nonatomic, readonly) NSUInteger width;
@property(nonatomic, readonly) NSUInteger height;
@property(nonatomic, readonly) GLfloat maxS;
@property(nonatomic, readonly) GLfloat maxT;
@property(nonatomic, readonly) CGSize textureRatio;
@property(nonatomic, readonly) Texture2DPixelFormat pixelFormat;

// Designated initializer that takes a UIImage and a filter (used for the MIN and MAG settings
// of the texture) and creates an OpenGL texture.
- (id) initWithImage:(UIImage*)aImage filter:(GLenum)aFilter;

- (id) initWithContentsFromFile:(NSString*)filename filter:(GLenum)aFilter;

@end